App.controller('loginController',function($rootScope, $scope, $state, API) {

	$('#loginForm').validate();
	
	$scope.login = function(){
		
		var user = $scope.user;
		
		if($('#loginForm').valid()){

            $state.go('app.main');
		}
	};
	
	$scope.enterEvent = function(e){
		
		var keycode = window.event ? e.keyCode : e.which;
		if(keycode==13){
			
            $scope.login();
        }
	};
	
	$scope.reset = function(){
		
		$scope.user = {};
	};
});